<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Hardware Abstraction Layer (HAL)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="logo.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Hardware Abstraction Layer (HAL)</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('group__group__hal__keyscan.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">Keyscan<div class="ingroups"><a class="el" href="group__group__hal.html">HAL Drivers</a></div></div></div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<p >High level interface for interacting with the KeyScan. </p>
<p >The KeyScan driver monitors a key matrix for actions and provides keycodes to the application for processing.</p>
<h1><a class="anchor" id="section_keyscan_features"></a>
Features</h1>
<ul>
<li>Configurable number of rows and columns</li>
<li>Detection of press, double press, triple press, and release actions</li>
<li>Buffering of multiple key actions without application intervention</li>
<li>Configurable callback for event-driven response to key actions</li>
</ul>
<p >See the implementation-specific documentation for information about device-specific limits on row count, column count, and buffer depth.</p>
<h1><a class="anchor" id="section_keyscan_quickstart"></a>
Quick Start</h1>
<p >Initialize a KeyScan instance using <a class="el" href="group__group__hal__keyscan.html#ga57f2f3a26d67dcdda74ba34637be68dc">cyhal_keyscan_init</a>, providing the pins that should be used for the rows and columns of the key matrix. Use <a class="el" href="group__group__hal__keyscan.html#ga72cbc5bdf8b4fbbbee972a079a335c8e">cyhal_keyscan_read</a> to read key actions.</p>
<p >See <a class="el" href="group__group__hal__keyscan.html#subsection_keyscan_snippet_1">Snippet 1: KeyScan initialization</a> for an example initialization. </p><dl class="section note"><dt>Note</dt><dd>The clock parameter (const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *clk) is optional and can be set to NULL to automatically configure and use an available clock resource with a default frequency.</dd></dl>
<h1><a class="anchor" id="section_keyscan_snippets"></a>
Code Snippets</h1>
<dl class="section note"><dt>Note</dt><dd>Error handling is omitted for clarity </dd></dl>
<h2><a class="anchor" id="subsection_keyscan_snippet_1"></a>
Snippet 1: KeyScan initialization</h2>
<p >This snippet initializes a KeyScan resource to scan a matrix of pins.</p>
<div class="fragment"><div class="line">    <span class="keyword">const</span> <a class="code hl_enumeration" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#ga707195ce0627016bf371643bdd9caa51">cyhal_gpio_t</a> rows[]    = { <a class="code hl_enumvalue" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#gga707195ce0627016bf371643bdd9caa51a23d505c049c81443b12e53d5b00b1be9">P0_0</a>, <a class="code hl_enumvalue" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#gga707195ce0627016bf371643bdd9caa51a8c239764fe5c947cad341b176d49eb73">P0_1</a>, <a class="code hl_enumvalue" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#gga707195ce0627016bf371643bdd9caa51a950df72443b521531bc3be8f4058fd85">P0_2</a> };</div>
<div class="line">    <span class="keyword">const</span> <a class="code hl_enumeration" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#ga707195ce0627016bf371643bdd9caa51">cyhal_gpio_t</a> columns[] = { <a class="code hl_enumvalue" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#gga707195ce0627016bf371643bdd9caa51aa25f499b57adc3dae9ca1a877f47f2af">P1_0</a>, <a class="code hl_enumvalue" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#gga707195ce0627016bf371643bdd9caa51ab0d32687fab06c4263f65b6741adf308">P1_1</a>, <a class="code hl_enumvalue" href="group__group__hal__impl__pin__package__psoc6__01__116__bga__ble.html#ggaf78d7d92acc4005cc057d8a9b48e6f28a12c69ba58f68ac9252a9e84170e354c7">P1_2</a> };</div>
<div class="line">    <a class="code hl_struct" href="group__group__hal__impl__hw__types.html#structcyhal__keyscan__t">cyhal_keyscan_t</a>    keyscan;</div>
<div class="line"> </div>
<div class="line">    <a class="code hl_typedef" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> result = <a class="code hl_function" href="group__group__hal__keyscan.html#ga57f2f3a26d67dcdda74ba34637be68dc">cyhal_keyscan_init</a>(&amp;keyscan, <span class="keyword">sizeof</span>(rows)/<span class="keyword">sizeof</span>(rows[0]), rows,</div>
<div class="line">                                          <span class="keyword">sizeof</span>(columns)/<span class="keyword">sizeof</span>(columns[0]), columns, NULL);</div>
<div class="ttc" id="agroup__group__hal__impl__hw__types_html_structcyhal__keyscan__t"><div class="ttname"><a href="group__group__hal__impl__hw__types.html#structcyhal__keyscan__t">cyhal_keyscan_t</a></div><div class="ttdoc">KeyScan object.</div><div class="ttdef"><b>Definition:</b> cyhal_hw_types.h:864</div></div>
<div class="ttc" id="agroup__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble_html_ga707195ce0627016bf371643bdd9caa51"><div class="ttname"><a href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#ga707195ce0627016bf371643bdd9caa51">cyhal_gpio_psoc6_01_104_m_csp_ble_t</a></div><div class="ttdeci">cyhal_gpio_psoc6_01_104_m_csp_ble_t</div><div class="ttdoc">Definitions for all of the pins that are bonded out on in the 104-M-CSP-BLE package for the PSoC6_01 ...</div><div class="ttdef"><b>Definition:</b> cyhal_psoc6_01_104_m_csp_ble.h:52</div></div>
<div class="ttc" id="agroup__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble_html_gga707195ce0627016bf371643bdd9caa51a23d505c049c81443b12e53d5b00b1be9"><div class="ttname"><a href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#gga707195ce0627016bf371643bdd9caa51a23d505c049c81443b12e53d5b00b1be9">P0_0</a></div><div class="ttdeci">@ P0_0</div><div class="ttdoc">Port 0 Pin 0.</div><div class="ttdef"><b>Definition:</b> cyhal_psoc6_01_104_m_csp_ble.h:55</div></div>
<div class="ttc" id="agroup__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble_html_gga707195ce0627016bf371643bdd9caa51a8c239764fe5c947cad341b176d49eb73"><div class="ttname"><a href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#gga707195ce0627016bf371643bdd9caa51a8c239764fe5c947cad341b176d49eb73">P0_1</a></div><div class="ttdeci">@ P0_1</div><div class="ttdoc">Port 0 Pin 1.</div><div class="ttdef"><b>Definition:</b> cyhal_psoc6_01_104_m_csp_ble.h:56</div></div>
<div class="ttc" id="agroup__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble_html_gga707195ce0627016bf371643bdd9caa51a950df72443b521531bc3be8f4058fd85"><div class="ttname"><a href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#gga707195ce0627016bf371643bdd9caa51a950df72443b521531bc3be8f4058fd85">P0_2</a></div><div class="ttdeci">@ P0_2</div><div class="ttdoc">Port 0 Pin 2.</div><div class="ttdef"><b>Definition:</b> cyhal_psoc6_01_104_m_csp_ble.h:57</div></div>
<div class="ttc" id="agroup__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble_html_gga707195ce0627016bf371643bdd9caa51aa25f499b57adc3dae9ca1a877f47f2af"><div class="ttname"><a href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#gga707195ce0627016bf371643bdd9caa51aa25f499b57adc3dae9ca1a877f47f2af">P1_0</a></div><div class="ttdeci">@ P1_0</div><div class="ttdoc">Port 1 Pin 0.</div><div class="ttdef"><b>Definition:</b> cyhal_psoc6_01_104_m_csp_ble.h:62</div></div>
<div class="ttc" id="agroup__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble_html_gga707195ce0627016bf371643bdd9caa51ab0d32687fab06c4263f65b6741adf308"><div class="ttname"><a href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#gga707195ce0627016bf371643bdd9caa51ab0d32687fab06c4263f65b6741adf308">P1_1</a></div><div class="ttdeci">@ P1_1</div><div class="ttdoc">Port 1 Pin 1.</div><div class="ttdef"><b>Definition:</b> cyhal_psoc6_01_104_m_csp_ble.h:63</div></div>
<div class="ttc" id="agroup__group__hal__impl__pin__package__psoc6__01__116__bga__ble_html_ggaf78d7d92acc4005cc057d8a9b48e6f28a12c69ba58f68ac9252a9e84170e354c7"><div class="ttname"><a href="group__group__hal__impl__pin__package__psoc6__01__116__bga__ble.html#ggaf78d7d92acc4005cc057d8a9b48e6f28a12c69ba58f68ac9252a9e84170e354c7">P1_2</a></div><div class="ttdeci">@ P1_2</div><div class="ttdoc">Port 1 Pin 2.</div><div class="ttdef"><b>Definition:</b> cyhal_psoc6_01_116_bga_ble.h:64</div></div>
<div class="ttc" id="agroup__group__hal__keyscan_html_ga57f2f3a26d67dcdda74ba34637be68dc"><div class="ttname"><a href="group__group__hal__keyscan.html#ga57f2f3a26d67dcdda74ba34637be68dc">cyhal_keyscan_init</a></div><div class="ttdeci">cy_rslt_t cyhal_keyscan_init(cyhal_keyscan_t *obj, uint8_t num_rows, const cyhal_gpio_t *rows, uint8_t num_columns, const cyhal_gpio_t *columns, const cyhal_clock_t *clock)</div><div class="ttdoc">Initialize the KeyScan peripheral.</div></div>
<div class="ttc" id="agroup__group__result_html_gaca79700fcc701534ce61778a9bcf57d1"><div class="ttname"><a href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a></div><div class="ttdeci">uint32_t cy_rslt_t</div><div class="ttdoc">Provides the result of an operation as a structured bitfield.</div><div class="ttdef"><b>Definition:</b> cy_result.h:438</div></div>
</div><!-- fragment --><h2><a class="anchor" id="subsection_keyscan_snippet_2"></a>
Snippet 2: Polling</h2>
<p >This snippet illustrates periodic polling for key actions</p>
<div class="fragment"><div class="line"><span class="preprocessor">    #define MAX_KEYS (20u)</span></div>
<div class="line">    <a class="code hl_struct" href="group__group__hal__keyscan.html#structcyhal__keyscan__action__t">cyhal_keyscan_action_t</a> key_actions[MAX_KEYS];</div>
<div class="line"> </div>
<div class="line">    <a class="code hl_struct" href="group__group__hal__impl__hw__types.html#structcyhal__keyscan__t">cyhal_keyscan_t</a> keyscan;</div>
<div class="line">    <span class="comment">// Initialize keyscan object as shown in snippet 1</span></div>
<div class="line"> </div>
<div class="line">    <span class="keywordflow">while</span> (loop)</div>
<div class="line">    {</div>
<div class="line">        uint8_t num_keys = MAX_KEYS;</div>
<div class="line">        result = <a class="code hl_function" href="group__group__hal__keyscan.html#ga72cbc5bdf8b4fbbbee972a079a335c8e">cyhal_keyscan_read</a>(&amp;keyscan, &amp;num_keys, key_actions);</div>
<div class="line">        CY_ASSERT(<a class="code hl_define" href="group__group__result.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a> == result);</div>
<div class="line">        <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; num_keys; ++i)</div>
<div class="line">        {</div>
<div class="line">            <span class="comment">// process key_actions[i]</span></div>
<div class="line">        }</div>
<div class="line"> </div>
<div class="line">        <span class="comment">// Perform other application processing while waiting for further key actions</span></div>
<div class="line">        <a class="code hl_function" href="group__group__hal__system.html#ga5f450769c1207d98134a9ced39adfdda">cyhal_system_delay_ms</a>(10u);</div>
<div class="line">    }</div>
<div class="ttc" id="agroup__group__hal__keyscan_html_ga72cbc5bdf8b4fbbbee972a079a335c8e"><div class="ttname"><a href="group__group__hal__keyscan.html#ga72cbc5bdf8b4fbbbee972a079a335c8e">cyhal_keyscan_read</a></div><div class="ttdeci">cy_rslt_t cyhal_keyscan_read(cyhal_keyscan_t *obj, uint8_t *count, cyhal_keyscan_action_t *keys)</div><div class="ttdoc">Reads up to the specified number of key actions.</div></div>
<div class="ttc" id="agroup__group__hal__keyscan_html_structcyhal__keyscan__action__t"><div class="ttname"><a href="group__group__hal__keyscan.html#structcyhal__keyscan__action__t">cyhal_keyscan_action_t</a></div><div class="ttdoc">Key action description.</div><div class="ttdef"><b>Definition:</b> cyhal_keyscan.h:112</div></div>
<div class="ttc" id="agroup__group__hal__system_html_ga5f450769c1207d98134a9ced39adfdda"><div class="ttname"><a href="group__group__hal__system.html#ga5f450769c1207d98134a9ced39adfdda">cyhal_system_delay_ms</a></div><div class="ttdeci">cy_rslt_t cyhal_system_delay_ms(uint32_t milliseconds)</div><div class="ttdoc">Requests that the current operation delays for at least the specified length of time.</div></div>
<div class="ttc" id="agroup__group__result_html_gaf58fac450d9fff4472f03ad68f6e546e"><div class="ttname"><a href="group__group__result.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a></div><div class="ttdeci">#define CY_RSLT_SUCCESS</div><div class="ttdoc">cy_rslt_t return value indicating success</div><div class="ttdef"><b>Definition:</b> cy_result.h:465</div></div>
</div><!-- fragment --><h2><a class="anchor" id="subsection_keyscan_snippet_3"></a>
Snippet 3: Event Handling</h2>
<p >This snippet shows how to register a callback which is invoked when a key action occurs.</p>
<div class="fragment"><div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> keyscan_event_handler(<span class="keywordtype">void</span>* arg, <a class="code hl_enumeration" href="group__group__hal__keyscan.html#gad09bc3db3d6f60c72e433eb63d0b4a71">cyhal_keyscan_event_t</a> event)</div>
<div class="line">{</div>
<div class="line">    <span class="keywordflow">if</span> (0u != (event &amp; <a class="code hl_enumvalue" href="group__group__hal__keyscan.html#ggad09bc3db3d6f60c72e433eb63d0b4a71af3fa8a7fc236565dc939d88e1d2032c3">CYHAL_KEYSCAN_EVENT_BUFFER_FULL</a>))</div>
<div class="line">    {</div>
<div class="line">        <a class="code hl_struct" href="group__group__hal__keyscan.html#structcyhal__keyscan__action__t">cyhal_keyscan_action_t</a> key_actions[MAX_KEYS];</div>
<div class="line">        uint8_t                num_keys = MAX_KEYS;</div>
<div class="line"> </div>
<div class="line">        <span class="comment">// When we registered the callback, we set &#39;arg&#39; to point to the keyscan object</span></div>
<div class="line">        <a class="code hl_struct" href="group__group__hal__impl__hw__types.html#structcyhal__keyscan__t">cyhal_keyscan_t</a>* keyscan = (<a class="code hl_struct" href="group__group__hal__impl__hw__types.html#structcyhal__keyscan__t">cyhal_keyscan_t</a>*)arg;</div>
<div class="line">        <a class="code hl_function" href="group__group__hal__keyscan.html#ga72cbc5bdf8b4fbbbee972a079a335c8e">cyhal_keyscan_read</a>(keyscan, &amp;num_keys, key_actions);</div>
<div class="line">        CY_ASSERT(num_keys &gt; 0);</div>
<div class="line"> </div>
<div class="line">        <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; num_keys; ++i)</div>
<div class="line">        {</div>
<div class="line">            <span class="comment">// process key_actions[i]</span></div>
<div class="line">        }</div>
<div class="line">    }</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="comment">//--------------------------------------------------------------------------------------------------</span></div>
<div class="line"><span class="comment">// snippet_cyhal_keyscan_event</span></div>
<div class="line"><span class="comment">//--------------------------------------------------------------------------------------------------</span></div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> snippet_cyhal_keyscan_event()</div>
<div class="line">{</div>
<div class="line">    <a class="code hl_struct" href="group__group__hal__impl__hw__types.html#structcyhal__keyscan__t">cyhal_keyscan_t</a> keyscan;</div>
<div class="line">    <span class="comment">// Initialize keyscan object as shown in snippet 1</span></div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Register a callback and set the callback argument to be a pointer to the keyscan object, so</span></div>
<div class="line">    <span class="comment">// that we can easily reference it from the callback handler.</span></div>
<div class="line">    <a class="code hl_function" href="group__group__hal__keyscan.html#ga98399ac6fd9b2a1d8c36d940188104c8">cyhal_keyscan_register_callback</a>(&amp;keyscan, &amp;keyscan_event_handler, &amp;keyscan);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Subscribe to the action detected event so that we can respond to new key actions</span></div>
<div class="line">    <a class="code hl_function" href="group__group__hal__keyscan.html#ga1a8f169699fdb7c3578111432843d57d">cyhal_keyscan_enable_event</a>(&amp;keyscan, <a class="code hl_enumvalue" href="group__group__hal__keyscan.html#ggad09bc3db3d6f60c72e433eb63d0b4a71a65ed379d77a1be0a6547c85829c6b9e6">CYHAL_KEYSCAN_EVENT_ACTION_DETECTED</a>,</div>
<div class="line">                               <a class="code hl_define" href="group__group__hal__impl__hw__types.html#gad822a466fc63847114add720ef84c83a">CYHAL_ISR_PRIORITY_DEFAULT</a>, <span class="keyword">true</span>);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="ttc" id="agroup__group__hal__impl__hw__types_html_gad822a466fc63847114add720ef84c83a"><div class="ttname"><a href="group__group__hal__impl__hw__types.html#gad822a466fc63847114add720ef84c83a">CYHAL_ISR_PRIORITY_DEFAULT</a></div><div class="ttdeci">#define CYHAL_ISR_PRIORITY_DEFAULT</div><div class="ttdoc">Priority that is applied by default to all drivers when initialized.</div><div class="ttdef"><b>Definition:</b> cyhal_hw_types.h:114</div></div>
<div class="ttc" id="agroup__group__hal__keyscan_html_ga1a8f169699fdb7c3578111432843d57d"><div class="ttname"><a href="group__group__hal__keyscan.html#ga1a8f169699fdb7c3578111432843d57d">cyhal_keyscan_enable_event</a></div><div class="ttdeci">void cyhal_keyscan_enable_event(cyhal_keyscan_t *obj, cyhal_keyscan_event_t event, uint8_t intr_priority, bool enable)</div><div class="ttdoc">Configure KeyScan events.</div></div>
<div class="ttc" id="agroup__group__hal__keyscan_html_ga98399ac6fd9b2a1d8c36d940188104c8"><div class="ttname"><a href="group__group__hal__keyscan.html#ga98399ac6fd9b2a1d8c36d940188104c8">cyhal_keyscan_register_callback</a></div><div class="ttdeci">void cyhal_keyscan_register_callback(cyhal_keyscan_t *obj, cyhal_keyscan_event_callback_t callback, void *callback_arg)</div><div class="ttdoc">Register a keyscan callback handler.</div></div>
<div class="ttc" id="agroup__group__hal__keyscan_html_gad09bc3db3d6f60c72e433eb63d0b4a71"><div class="ttname"><a href="group__group__hal__keyscan.html#gad09bc3db3d6f60c72e433eb63d0b4a71">cyhal_keyscan_event_t</a></div><div class="ttdeci">cyhal_keyscan_event_t</div><div class="ttdoc">KeyScan events.</div><div class="ttdef"><b>Definition:</b> cyhal_keyscan.h:99</div></div>
<div class="ttc" id="agroup__group__hal__keyscan_html_ggad09bc3db3d6f60c72e433eb63d0b4a71a65ed379d77a1be0a6547c85829c6b9e6"><div class="ttname"><a href="group__group__hal__keyscan.html#ggad09bc3db3d6f60c72e433eb63d0b4a71a65ed379d77a1be0a6547c85829c6b9e6">CYHAL_KEYSCAN_EVENT_ACTION_DETECTED</a></div><div class="ttdeci">@ CYHAL_KEYSCAN_EVENT_ACTION_DETECTED</div><div class="ttdoc">Key action detected.</div><div class="ttdef"><b>Definition:</b> cyhal_keyscan.h:101</div></div>
<div class="ttc" id="agroup__group__hal__keyscan_html_ggad09bc3db3d6f60c72e433eb63d0b4a71af3fa8a7fc236565dc939d88e1d2032c3"><div class="ttname"><a href="group__group__hal__keyscan.html#ggad09bc3db3d6f60c72e433eb63d0b4a71af3fa8a7fc236565dc939d88e1d2032c3">CYHAL_KEYSCAN_EVENT_BUFFER_FULL</a></div><div class="ttdeci">@ CYHAL_KEYSCAN_EVENT_BUFFER_FULL</div><div class="ttdoc">Keycode buffer is full.</div><div class="ttdef"><b>Definition:</b> cyhal_keyscan.h:102</div></div>
</div><!-- fragment --> <table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:structcyhal__keyscan__action__t"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__keyscan.html#structcyhal__keyscan__action__t">cyhal_keyscan_action_t</a></td></tr>
<tr class="memdesc:structcyhal__keyscan__action__t"><td class="mdescLeft">&#160;</td><td class="mdescRight">Key action description.  <a href="group__group__hal__keyscan.html#structcyhal__keyscan__action__t">More...</a><br /></td></tr>
<tr class="separator:structcyhal__keyscan__action__t"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="define-members" name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:ga24962197de0882712e545945b340ffb0"><td class="memItemLeft" align="right" valign="top"><a id="ga24962197de0882712e545945b340ffb0" name="ga24962197de0882712e545945b340ffb0"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>CYHAL_KEYSCAN_RSLT_ERR_INVALID_PIN</b>&#160;&#160;&#160;  (<a class="el" href="group__group__result.html#ga7b3e119b13a8bb398f429a22d8cf4dcd">CY_RSLT_CREATE_EX</a>(<a class="el" href="group__group__result.html#gga379d2c0a6a4ef22f04e53e8eb4c9ee79aac3d9861cc429ed0a29962e7829f4160">CY_RSLT_TYPE_ERROR</a>, <a class="el" href="group__group__result.html#gga9008565cba0207520330a1cb8509a8d0a79b500d6463aadd493b3812f779f75df">CY_RSLT_MODULE_ABSTRACTION_HAL</a>, <a class="el" href="group__group__hal__results.html#gga84f32ecb6376e2088d4f048e35f52005ae22cca7b373e114a80c8f1aa33d42619">CYHAL_RSLT_MODULE_KEYSCAN</a>, 0))</td></tr>
<tr class="memdesc:ga24962197de0882712e545945b340ffb0"><td class="mdescLeft">&#160;</td><td class="mdescRight">An invalid pin location was specified. <br /></td></tr>
<tr class="separator:ga24962197de0882712e545945b340ffb0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga53661ec35d37319a7b5e613eec53479f"><td class="memItemLeft" align="right" valign="top"><a id="ga53661ec35d37319a7b5e613eec53479f" name="ga53661ec35d37319a7b5e613eec53479f"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>CYHAL_KEYSCAN_RSLT_ERR_INVALID_ARG</b>&#160;&#160;&#160;  (<a class="el" href="group__group__result.html#ga7b3e119b13a8bb398f429a22d8cf4dcd">CY_RSLT_CREATE_EX</a>(<a class="el" href="group__group__result.html#gga379d2c0a6a4ef22f04e53e8eb4c9ee79aac3d9861cc429ed0a29962e7829f4160">CY_RSLT_TYPE_ERROR</a>, <a class="el" href="group__group__result.html#gga9008565cba0207520330a1cb8509a8d0a79b500d6463aadd493b3812f779f75df">CY_RSLT_MODULE_ABSTRACTION_HAL</a>, <a class="el" href="group__group__hal__results.html#gga84f32ecb6376e2088d4f048e35f52005ae22cca7b373e114a80c8f1aa33d42619">CYHAL_RSLT_MODULE_KEYSCAN</a>, 1))</td></tr>
<tr class="memdesc:ga53661ec35d37319a7b5e613eec53479f"><td class="mdescLeft">&#160;</td><td class="mdescRight">An invalid argument was provided. <br /></td></tr>
<tr class="separator:ga53661ec35d37319a7b5e613eec53479f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4d4401ad05e163844fef786a71e44342"><td class="memItemLeft" align="right" valign="top"><a id="ga4d4401ad05e163844fef786a71e44342" name="ga4d4401ad05e163844fef786a71e44342"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>CYHAL_KEYSCAN_RSLT_ERR_INIT_FAILED</b>&#160;&#160;&#160;  (<a class="el" href="group__group__result.html#ga7b3e119b13a8bb398f429a22d8cf4dcd">CY_RSLT_CREATE_EX</a>(<a class="el" href="group__group__result.html#gga379d2c0a6a4ef22f04e53e8eb4c9ee79aac3d9861cc429ed0a29962e7829f4160">CY_RSLT_TYPE_ERROR</a>, <a class="el" href="group__group__result.html#gga9008565cba0207520330a1cb8509a8d0a79b500d6463aadd493b3812f779f75df">CY_RSLT_MODULE_ABSTRACTION_HAL</a>, <a class="el" href="group__group__hal__results.html#gga84f32ecb6376e2088d4f048e35f52005ae22cca7b373e114a80c8f1aa33d42619">CYHAL_RSLT_MODULE_KEYSCAN</a>, 2))</td></tr>
<tr class="memdesc:ga4d4401ad05e163844fef786a71e44342"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialization of the KeyScan hardware failed. <br /></td></tr>
<tr class="separator:ga4d4401ad05e163844fef786a71e44342"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="typedef-members" name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:ga292217767d0b5e6cdc7a8c487b6e0bc2"><td class="memItemLeft" align="right" valign="top"><a id="ga292217767d0b5e6cdc7a8c487b6e0bc2" name="ga292217767d0b5e6cdc7a8c487b6e0bc2"></a>
typedef void(*&#160;</td><td class="memItemRight" valign="bottom"><b>cyhal_keyscan_event_callback_t</b>) (void *callback_arg, <a class="el" href="group__group__hal__keyscan.html#gad09bc3db3d6f60c72e433eb63d0b4a71">cyhal_keyscan_event_t</a> event)</td></tr>
<tr class="memdesc:ga292217767d0b5e6cdc7a8c487b6e0bc2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Handler for KeyScan event callbacks. <br /></td></tr>
<tr class="separator:ga292217767d0b5e6cdc7a8c487b6e0bc2"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="enum-members" name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:gad09bc3db3d6f60c72e433eb63d0b4a71"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__keyscan.html#gad09bc3db3d6f60c72e433eb63d0b4a71">cyhal_keyscan_event_t</a> { <br />
&#160;&#160;<a class="el" href="group__group__hal__keyscan.html#ggad09bc3db3d6f60c72e433eb63d0b4a71a554eebe890cfb0578d09f977431f75bb">CYHAL_KEYSCAN_EVENT_NONE</a> = 0
, <br />
&#160;&#160;<a class="el" href="group__group__hal__keyscan.html#ggad09bc3db3d6f60c72e433eb63d0b4a71a65ed379d77a1be0a6547c85829c6b9e6">CYHAL_KEYSCAN_EVENT_ACTION_DETECTED</a> = 1 &lt;&lt; 0
, <br />
&#160;&#160;<a class="el" href="group__group__hal__keyscan.html#ggad09bc3db3d6f60c72e433eb63d0b4a71af3fa8a7fc236565dc939d88e1d2032c3">CYHAL_KEYSCAN_EVENT_BUFFER_FULL</a> = 1 &lt;&lt; 1
<br />
 }</td></tr>
<tr class="memdesc:gad09bc3db3d6f60c72e433eb63d0b4a71"><td class="mdescLeft">&#160;</td><td class="mdescRight">KeyScan events.  <a href="group__group__hal__keyscan.html#gad09bc3db3d6f60c72e433eb63d0b4a71">More...</a><br /></td></tr>
<tr class="separator:gad09bc3db3d6f60c72e433eb63d0b4a71"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga509bf82ac2738c095161337bd7062356"><td class="memItemLeft" align="right" valign="top"><a id="ga509bf82ac2738c095161337bd7062356" name="ga509bf82ac2738c095161337bd7062356"></a>enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__keyscan.html#ga509bf82ac2738c095161337bd7062356">cyhal_keyscan_action_type_t</a> { <br />
&#160;&#160;<b>CYHAL_KEYSCAN_ACTION_PRESS</b>
, <br />
&#160;&#160;<b>CYHAL_KEYSCAN_ACTION_RELEASE</b>
<br />
 }</td></tr>
<tr class="memdesc:ga509bf82ac2738c095161337bd7062356"><td class="mdescLeft">&#160;</td><td class="mdescRight">Key action types. <br /></td></tr>
<tr class="separator:ga509bf82ac2738c095161337bd7062356"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga57f2f3a26d67dcdda74ba34637be68dc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__keyscan.html#ga57f2f3a26d67dcdda74ba34637be68dc">cyhal_keyscan_init</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__keyscan__t">cyhal_keyscan_t</a> *obj, uint8_t num_rows, const <a class="el" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#ga707195ce0627016bf371643bdd9caa51">cyhal_gpio_t</a> *rows, uint8_t num_columns, const <a class="el" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#ga707195ce0627016bf371643bdd9caa51">cyhal_gpio_t</a> *columns, const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *clock)</td></tr>
<tr class="memdesc:ga57f2f3a26d67dcdda74ba34637be68dc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize the KeyScan peripheral.  <a href="group__group__hal__keyscan.html#ga57f2f3a26d67dcdda74ba34637be68dc">More...</a><br /></td></tr>
<tr class="separator:ga57f2f3a26d67dcdda74ba34637be68dc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2a147e08210f725c0a7a1b8930e3898f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__keyscan.html#ga2a147e08210f725c0a7a1b8930e3898f">cyhal_keyscan_free</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__keyscan__t">cyhal_keyscan_t</a> *obj)</td></tr>
<tr class="memdesc:ga2a147e08210f725c0a7a1b8930e3898f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deinitialize the KeyScan object and release the associated hardware resources.  <a href="group__group__hal__keyscan.html#ga2a147e08210f725c0a7a1b8930e3898f">More...</a><br /></td></tr>
<tr class="separator:ga2a147e08210f725c0a7a1b8930e3898f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga72cbc5bdf8b4fbbbee972a079a335c8e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__keyscan.html#ga72cbc5bdf8b4fbbbee972a079a335c8e">cyhal_keyscan_read</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__keyscan__t">cyhal_keyscan_t</a> *obj, uint8_t *count, <a class="el" href="group__group__hal__keyscan.html#structcyhal__keyscan__action__t">cyhal_keyscan_action_t</a> *keys)</td></tr>
<tr class="memdesc:ga72cbc5bdf8b4fbbbee972a079a335c8e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads up to the specified number of key actions.  <a href="group__group__hal__keyscan.html#ga72cbc5bdf8b4fbbbee972a079a335c8e">More...</a><br /></td></tr>
<tr class="separator:ga72cbc5bdf8b4fbbbee972a079a335c8e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga98399ac6fd9b2a1d8c36d940188104c8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__keyscan.html#ga98399ac6fd9b2a1d8c36d940188104c8">cyhal_keyscan_register_callback</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__keyscan__t">cyhal_keyscan_t</a> *obj, <a class="el" href="group__group__hal__keyscan.html#ga292217767d0b5e6cdc7a8c487b6e0bc2">cyhal_keyscan_event_callback_t</a> callback, void *callback_arg)</td></tr>
<tr class="memdesc:ga98399ac6fd9b2a1d8c36d940188104c8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Register a keyscan callback handler.  <a href="group__group__hal__keyscan.html#ga98399ac6fd9b2a1d8c36d940188104c8">More...</a><br /></td></tr>
<tr class="separator:ga98399ac6fd9b2a1d8c36d940188104c8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1a8f169699fdb7c3578111432843d57d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__keyscan.html#ga1a8f169699fdb7c3578111432843d57d">cyhal_keyscan_enable_event</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__keyscan__t">cyhal_keyscan_t</a> *obj, <a class="el" href="group__group__hal__keyscan.html#gad09bc3db3d6f60c72e433eb63d0b4a71">cyhal_keyscan_event_t</a> event, uint8_t intr_priority, bool enable)</td></tr>
<tr class="memdesc:ga1a8f169699fdb7c3578111432843d57d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Configure KeyScan events.  <a href="group__group__hal__keyscan.html#ga1a8f169699fdb7c3578111432843d57d">More...</a><br /></td></tr>
<tr class="separator:ga1a8f169699fdb7c3578111432843d57d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaed11b0ccfa0cb5fcd205d44f9aec81ca"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__keyscan.html#gaed11b0ccfa0cb5fcd205d44f9aec81ca">cyhal_keyscan_init_cfg</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__keyscan__t">cyhal_keyscan_t</a> *obj, const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__keyscan__configurator__t">cyhal_keyscan_configurator_t</a> *cfg)</td></tr>
<tr class="memdesc:gaed11b0ccfa0cb5fcd205d44f9aec81ca"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize the KeyScan peripheral using a configurator generated configuration struct.  <a href="group__group__hal__keyscan.html#gaed11b0ccfa0cb5fcd205d44f9aec81ca">More...</a><br /></td></tr>
<tr class="separator:gaed11b0ccfa0cb5fcd205d44f9aec81ca"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<hr/><h2 class="groupheader">Data Structure Documentation</h2>
<a name="structcyhal__keyscan__action__t" id="structcyhal__keyscan__action__t"></a>
<h2 class="memtitle"><span class="permalink"><a href="#structcyhal__keyscan__action__t">&#9670;&nbsp;</a></span>cyhal_keyscan_action_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct cyhal_keyscan_action_t</td>
        </tr>
      </table>
</div><div class="memdoc">
<table class="fieldtable">
<tr><th colspan="3">Data Fields</th></tr>
<tr><td class="fieldtype">
<a id="a438d909418d2e1a393e541399cc776c6" name="a438d909418d2e1a393e541399cc776c6"></a>uint8_t</td>
<td class="fieldname">
keycode</td>
<td class="fielddoc">
Code indicating which key the action applies to. <p >Keycodes are assigned sequentially in column order. For example, in a key matrix with five rows and two columns, column 0 would be represented by keycode 0 - 4, and column 1 by keycode 5-9. </p>
</td></tr>
<tr><td class="fieldtype">
<a id="a4cc5955dfd82468151ff4ac04ae739f2" name="a4cc5955dfd82468151ff4ac04ae739f2"></a><a class="el" href="group__group__hal__keyscan.html#ga509bf82ac2738c095161337bd7062356">cyhal_keyscan_action_type_t</a></td>
<td class="fieldname">
action</td>
<td class="fielddoc">
The type of key action that was performd. </td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a id="gad09bc3db3d6f60c72e433eb63d0b4a71" name="gad09bc3db3d6f60c72e433eb63d0b4a71"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad09bc3db3d6f60c72e433eb63d0b4a71">&#9670;&nbsp;</a></span>cyhal_keyscan_event_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="group__group__hal__keyscan.html#gad09bc3db3d6f60c72e433eb63d0b4a71">cyhal_keyscan_event_t</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>KeyScan events. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="ggad09bc3db3d6f60c72e433eb63d0b4a71a554eebe890cfb0578d09f977431f75bb" name="ggad09bc3db3d6f60c72e433eb63d0b4a71a554eebe890cfb0578d09f977431f75bb"></a>CYHAL_KEYSCAN_EVENT_NONE&#160;</td><td class="fielddoc"><p >No interrupt. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggad09bc3db3d6f60c72e433eb63d0b4a71a65ed379d77a1be0a6547c85829c6b9e6" name="ggad09bc3db3d6f60c72e433eb63d0b4a71a65ed379d77a1be0a6547c85829c6b9e6"></a>CYHAL_KEYSCAN_EVENT_ACTION_DETECTED&#160;</td><td class="fielddoc"><p >Key action detected. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggad09bc3db3d6f60c72e433eb63d0b4a71af3fa8a7fc236565dc939d88e1d2032c3" name="ggad09bc3db3d6f60c72e433eb63d0b4a71af3fa8a7fc236565dc939d88e1d2032c3"></a>CYHAL_KEYSCAN_EVENT_BUFFER_FULL&#160;</td><td class="fielddoc"><p >Keycode buffer is full. </p>
</td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga57f2f3a26d67dcdda74ba34637be68dc" name="ga57f2f3a26d67dcdda74ba34637be68dc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga57f2f3a26d67dcdda74ba34637be68dc">&#9670;&nbsp;</a></span>cyhal_keyscan_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_keyscan_init </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__keyscan__t">cyhal_keyscan_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>num_rows</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#ga707195ce0627016bf371643bdd9caa51">cyhal_gpio_t</a> *&#160;</td>
          <td class="paramname"><em>rows</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>num_columns</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#ga707195ce0627016bf371643bdd9caa51">cyhal_gpio_t</a> *&#160;</td>
          <td class="paramname"><em>columns</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *&#160;</td>
          <td class="paramname"><em>clock</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize the KeyScan peripheral. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">obj</td><td>Pointer to a KeyScan object. The caller must allocate the memory for this object but the init function will initialize its contents. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">num_rows</td><td>The number of rows in the key matrix </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">rows</td><td>Array of pins corresponding to the key matrix rows </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">num_columns</td><td>The number of columns in the key matrix </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">columns</td><td>Array of pins corresponding to the key matrix columns </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">clock</td><td>Clock source to use for this instance. If NULL, a dedicated clock will be automatically allocated for this instance. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the init request </dd></dl>

</div>
</div>
<a id="ga2a147e08210f725c0a7a1b8930e3898f" name="ga2a147e08210f725c0a7a1b8930e3898f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga2a147e08210f725c0a7a1b8930e3898f">&#9670;&nbsp;</a></span>cyhal_keyscan_free()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cyhal_keyscan_free </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__keyscan__t">cyhal_keyscan_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Deinitialize the KeyScan object and release the associated hardware resources. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The KeyScan object </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga72cbc5bdf8b4fbbbee972a079a335c8e" name="ga72cbc5bdf8b4fbbbee972a079a335c8e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga72cbc5bdf8b4fbbbee972a079a335c8e">&#9670;&nbsp;</a></span>cyhal_keyscan_read()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_keyscan_read </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__keyscan__t">cyhal_keyscan_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>count</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__keyscan.html#structcyhal__keyscan__action__t">cyhal_keyscan_action_t</a> *&#160;</td>
          <td class="paramname"><em>keys</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Reads up to the specified number of key actions. </p>
<dl class="section note"><dt>Note</dt><dd>If an error code is returned, this function will contain partial information up to the number of keys read.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The KeyScan object </td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">count</td><td>The number of key action to read. Updated with the number of keys actually read. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">keys</td><td>The array into which key action descriptions should be written, starting from the least recent key action at index 0. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the read request </dd></dl>

</div>
</div>
<a id="ga98399ac6fd9b2a1d8c36d940188104c8" name="ga98399ac6fd9b2a1d8c36d940188104c8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga98399ac6fd9b2a1d8c36d940188104c8">&#9670;&nbsp;</a></span>cyhal_keyscan_register_callback()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cyhal_keyscan_register_callback </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__keyscan__t">cyhal_keyscan_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__keyscan.html#ga292217767d0b5e6cdc7a8c487b6e0bc2">cyhal_keyscan_event_callback_t</a>&#160;</td>
          <td class="paramname"><em>callback</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>callback_arg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Register a keyscan callback handler. </p>
<p >This function will be called when one of the events enabled by <a class="el" href="group__group__hal__keyscan.html#ga1a8f169699fdb7c3578111432843d57d">cyhal_keyscan_enable_event</a> occurs.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The KeyScan object </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>The callback handler which will be invoked when the event occurs </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">callback_arg</td><td>Generic argument that will be provided to the callback when called </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga1a8f169699fdb7c3578111432843d57d" name="ga1a8f169699fdb7c3578111432843d57d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1a8f169699fdb7c3578111432843d57d">&#9670;&nbsp;</a></span>cyhal_keyscan_enable_event()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cyhal_keyscan_enable_event </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__keyscan__t">cyhal_keyscan_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__keyscan.html#gad09bc3db3d6f60c72e433eb63d0b4a71">cyhal_keyscan_event_t</a>&#160;</td>
          <td class="paramname"><em>event</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>intr_priority</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>enable</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Configure KeyScan events. </p>
<p >When an enabled event occurs, the function specified by <a class="el" href="group__group__hal__keyscan.html#ga98399ac6fd9b2a1d8c36d940188104c8">cyhal_keyscan_register_callback</a> will be called.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The KeyScan object </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">event</td><td>The KeyScan event type </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">intr_priority</td><td>The priority for NVIC interrupt events </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">enable</td><td>True to turn on the specified event, False to turn off </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gaed11b0ccfa0cb5fcd205d44f9aec81ca" name="gaed11b0ccfa0cb5fcd205d44f9aec81ca"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaed11b0ccfa0cb5fcd205d44f9aec81ca">&#9670;&nbsp;</a></span>cyhal_keyscan_init_cfg()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_keyscan_init_cfg </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__keyscan__t">cyhal_keyscan_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__keyscan__configurator__t">cyhal_keyscan_configurator_t</a> *&#160;</td>
          <td class="paramname"><em>cfg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize the KeyScan peripheral using a configurator generated configuration struct. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>Pointer to a KeyScan object. The caller must allocate the memory for this object but the init function will initialize its contents. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">cfg</td><td>Configuration structure generated by a configurator. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the operation </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>Hardware Abstraction Layer (HAL)</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
